package com.farmer.mapper;

import com.farmer.pojo.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 86183
* @description 针对表【comment(评论信息表)】的数据库操作Mapper
* @createDate 2024-05-03 16:00:28
* @Entity com.farmer.pojo.Comment
*/
@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    @Select("select comment.*, user.avatar, user.name as userName " +
            "from comment " +
            "left join user on comment.user_id = user.id " +
            "where comment.policy_id = #{policyId} " +
            "order by comment.id desc")
    List<Comment> getByPolicyId(@Param("policyId") Integer policyId);
}




